{include file="common/mainHead"/}
<div class="admin-main fadeInUp animated">
    <blockquote class="layui-elem-quote">
        <a href="{:url('WebQualify/index')}?goodsid={$good_info['id']}" class="layui-btn layui-btn-small">
            资格审核
        </a>
        <a href="{:url('WebBidden/index')}?goodsid={$good_info['id']}" class="layui-btn layui-btn-small">
            出价记录
        </a>
        <a href="{:url('WebAucwords/index')}?goodsid={$good_info['id']} " class="layui-btn layui-btn-small">
            拍卖师发言
        </a>
        <a href="{:url('WebGoods/editGood')}?id={$good_info['id']}&con=op" class="layui-btn layui-btn-small">
            修改（该操作必须先暂停拍品）
        </a>
        <a href="{:url('WebGoods/index')}?id={$good_info['auct_id']}" class="layui-btn layui-btn-small">
            返回拍品列表
        </a>
    </blockquote>
    <fieldset class="layui-elem-field">
        <legend>拍品信息</legend>
        <div class="layui-field-box table-responsive">
            <form class="layui-form layui-form-pane">
                <table class="layui-table table-hover">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>参与人数</th>
                        <th>目前最高</th>
                        <th>状态</th>
                        <th>起拍价</th>
                        <th>加价幅度</th>
                        <th>保留价</th>
                    </tr>
                    </thead>
                    <!--内容容器-->
                    <tbody id="con">
                        <tr>
                            <td>{$good_info['id']}</td>
                            <td>{$good_info['user_num']}人</td>
                            <td>￥{$good_info['highest']}</td>
                            <td style="color:red;">
                                <?php
                                    if($good_info['is_end'] ==0 ){
                                 if($good_info['is_giveup']==1){
                                    echo '被放弃';
                                 }else{
                                 if($good_info['is_pause']==1){
                                    echo '进行中';
                                 }else{
                                    //未开始或被暂停（这块儿不好区分）
                                    if($good_info['starttime'])//如果存在开始时间肯定是开始了的被暂停了
                                        echo '被暂停';
                                    else
                                        echo '未开始';
                                 }
                                 }
                                 }else{
                                 if($good_info['is_sure']==1){
                                    echo '已流拍';
                                 }else{
                                    echo '已成交';
                                 }
                                 }
                                ?>
                            </td>
                            <td>￥{$good_info['start_price']}</td>
                            <td>￥{$good_info['marup_price']}</td>
                            <td>￥{$good_info['end_price']}</td>
                        </tr>
                    </tbody>

                </table>
            </form>
            <button type="button" onclick="suspendGood({$good_info['id']})" class="layui-btn" >暂停拍品</button>
            <button type="button" onclick="startGood({$good_info['id']})" class="layui-btn" >开始拍品</button>
            <button type="button" onclick="giveUpGood({$good_info['id']})" class="layui-btn" >放弃拍品</button>
        </div>
    </fieldset>
</div>
{include file="common/mainFoot"/}
<script>
        layui.config({
        base: '__ADMIN__/js/'
    }).use(['paging', 'code','icheck','layer'], function() {

    });
        function getdate(date){
            var date = new Date(date*1000);//如果date为10位不需要乘1000
            var Y = date.getFullYear() + '-';
            var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
            var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
            var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
            var m = (date.getMinutes() <10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
            var s = (date.getSeconds() <10 ? '0' + date.getSeconds() : date.getSeconds());
            return Y+M+D+h+m+s;
        }

        function stateyes(id) {
            $.post('{:url("goodsState")}', {id: id}, function (data) {
                if (data.status) {
                    if (data.info == '已撤回') {
                        var a = '<button class="layui-btn layui-btn-danger layui-btn-mini">已撤回</button>'
                        $('#zt' + id).html(a);
                        layer.msg(data.info, {icon: 5});
                        return false;
                    } else {
                        var b = '<button class="layui-btn layui-btn-warm layui-btn-mini">已发布</button>'
                        $('#zt' + id).html(b);
                        layer.msg(data.info, {icon: 6});
                        return false;
                    }
                }else{
                    layer.msg(data.msg,{time:1000,icon:2});
                    return false;
                }
            });
            return false;
        }


        function suspendGood(id) {
            if({$good_info['is_pause']} == 0){
                alert('该拍品状态已经是暂停');
                return ;
            }
            layer.confirm('你确定要暂停拍品吗？', {icon: 3}, function (index){
                layer.close(index);
                window.location.href = "{:url('suspendGood')}?id=" + id;
            });
        }

        function startGood(id) {
            if({$good_info['is_pause']} == 1){
                alert('该拍品状态已经是开始，拍卖进行中');
                return ;
            }
            layer.confirm('你确定要开始该拍品吗？', {icon: 3}, function (index){
                layer.close(index);
                window.location.href = "{:url('startGood')}?id=" + id;
            });
        }

        function giveUpGood(id) {
            if({$good_info['is_giveup']} == 1){
                alert('该拍品状态已经被放弃');
                return ;
            }
            layer.confirm('你确定要放弃该拍品吗？', {icon: 3}, function (index){
                layer.close(index);
                window.location.href = "{:url('giveUpGood')}?id=" + id;
            });
        }

</script>